﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Rhino.Mocks;
using WebFormsMvp.Contrib.Models;
using WebFormsMvp.Contrib.Presenters;

namespace WebFormsMvp.Contrib.Tests
{
    [TestClass]
    public class GoogleAnalyticsPresenterTests
    {
        [TestMethod]
        public void Default_Tracking_Code_Invalid()
        {
            //Arrange
            var view = MockRepository.GenerateMock<IView<GoogleAnalyticsModel>>();
            view.Expect(v => v.Model).Return(new GoogleAnalyticsModel());

            var presenter = new GoogleAnalyticsPresenter(view);

            //Act
            view.Raise(v => v.Load += null, this, EventArgs.Empty);
            presenter.ReleaseView();

            //Assert
            Assert.IsNotNull(view.Model.TrackingCode);
            Assert.AreEqual("TrackingCode no set", view.Model.TrackingCode);
            view.VerifyAllExpectations();
        }
    }
}
